package com.lsy.poi.cell.extractor;

import org.apache.poi.xssf.usermodel.XSSFCell;

import com.lsy.poi.Logger;
import com.lsy.poi.exception.cell.ExtractorException;

public abstract class CellExtractor extends Logger {
	
	public abstract Object doExtract(XSSFCell cell) throws ExtractorException;
	
	public Object extract(XSSFCell cell) {
		try {
			
			return doExtract(cell);
			
		} catch (ExtractorException e) {
			/*
			 * 1) 当 doExtract() 发生 ExtractorException 时：
			 * doExtract(): 会报错、终端
			 * extract(): 会捕捉，并 logError
			 * 
			 * 2) 当 doExtract() 发生 RuntimeException 时：
			 * doExtract(): 会报错、终端
			 * extract(): 会报错、终端
			 */
			logError(e);
		}
		
		return null;
	}

}
